﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;

namespace DAL
{
    class D_BasicInformationCustom : IDAL.IBasicInformationCustom
    {
        WishDayEntities _e;
        public D_BasicInformationCustom()
        {
            _e = new WishDayEntities();
        }
        public void Add(BasicInformationCustom obj)
        {
            _e.BasicInformationCustom.Add(obj);
            _e.SaveChanges();
        }

        public void Delete(int id)
        {
            var data = _e.BasicInformationCustom.Find(id);
            _e.BasicInformationCustom.Remove(data);
            _e.SaveChanges();
        }

        public BasicInformationCustom FindById(int id)
        {
            return _e.BasicInformationCustom.Find(id);
        }

        public List<BasicInformationCustom> GetAll()
        {
            return _e.BasicInformationCustom.ToList();
        }

        public void Update(int id, BasicInformationCustom obj)
        {
            var data = _e.BasicInformationCustom.Find(id);
            data.BICName = obj.BICName;
            data.BICDescribe = obj.BICDescribe;
            data.BasicID = obj.BasicID;
            _e.SaveChanges();
        }
    }
}
